package cn.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import cn.pojo.Detail;

public interface DetailMapper {

	// 获得所有的帖子明细表信息
	@Select("select * from bbs_detail order by id desc ;")
	List<Detail> getAll();

	// 2、测试用户名是否可用: testAuthor
	@Select("select * from bbs_detail where author=# {author} ")
	Detail testAuthor(Detail detail);

	// 3、ajax验证标题:testTitle
	@Select("select * from bbs_detail where title=# {title} ")
	Detail testTitle(Detail detail);

	// 4、提交表单:toUserAdd
	@Insert("insert into bbs_detail (title,author,createDate,replyCount) vaules (#{title},#{author},#{createDate},#{replyCount})")
	@Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
	int toUserAdd(Detail detail);

}
